Game rắn săn mồi bằng c# _ snake full code
16.748 lượt xem;
- Form1.Designer.cs
- project /
1 namespace Snake
2 {
3 partial class Form1
4 {
5 /// <summary>
6 /// Required designer variable.
7 /// </summary>
8 private System.ComponentModel.IContainer components = null;
9
10 /// <summary>
11 /// Clean up any resources being used.
12 /// </summary>
13 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14 protected override void Dispose(bool disposing)
15 {
16 if (disposing && (components != null))
17 {
18 components.Dispose();
19 }
20 base.Dispose(disposing);
21 }
22
23 #region Windows Form Designer generated code
24
25 /// <summary>
26 /// Required method for Designer support - do not modify
27 /// the contents of this method with the code editor.
28 /// </summary>
29 private void InitializeComponent()
30 {
31 this.components = new System.ComponentModel.Container();
32 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
33 this.pbCanvas = new System.Windows.Forms.PictureBox();
34 this.lblScore = new System.Windows.Forms.Label();
35 this.gameTimer = new System.Windows.Forms.Timer(this.components);
36 this.lblGameOver = new System.Windows.Forms.Label();
37 this.panel1 = new System.Windows.Forms.Panel();
38 this.panel2 = new System.Windows.Forms.Panel();
39 this.panel3 = new System.Windows.Forms.Panel();
40 this.panel4 = new System.Windows.Forms.Panel();
41 this.ptbGameOver = new System.Windows.Forms.PictureBox();
42 ((System.ComponentModel.ISupportInitialize)(this.pbCanvas)).BeginInit();
43 this.panel1.SuspendLayout();
44 ((System.ComponentModel.ISupportInitialize)(this.ptbGameOver)).BeginInit();
45 this.SuspendLayout();
46 //
47 // pbCanvas
48 //
49 this.pbCanvas.BackColor = System.Drawing.SystemColors.ScrollBar;
50 this.pbCanvas.Location = new System.Drawing.Point(13, 13);
51 this.pbCanvas.Name = "pbCanvas";
52 this.pbCanvas.Size = new System.Drawing.Size(432, 424);
53 this.pbCanvas.TabIndex = 0;
54 this.pbCanvas.TabStop = false;
55 this.pbCanvas.Paint += new System.Windows.Forms.PaintEventHandler(this.pbCanvas_Paint);
56 //
57 // lblScore
58 //
59 this.lblScore.AutoSize = true;
60 this.lblScore.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
61 this.lblScore.ForeColor = System.Drawing.Color.Blue;
62 this.lblScore.Location = new System.Drawing.Point(83, 18);
63 this.lblScore.Name = "lblScore";
64 this.lblScore.Size = new System.Drawing.Size(0, 37);
65 this.lblScore.TabIndex = 2;
66 //
67 // lblGameOver
68 //
69 this.lblGameOver.AutoSize = true;
70 this.lblGameOver.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
71 this.lblGameOver.ForeColor = System.Drawing.Color.Red;
72 this.lblGameOver.Location = new System.Drawing.Point(158, 405);
73 this.lblGameOver.Name = "lblGameOver";
74 this.lblGameOver.Size = new System.Drawing.Size(79, 29);
75 this.lblGameOver.TabIndex = 3;
76 this.lblGameOver.Text = "label2";
77 this.lblGameOver.Visible = false;
78 //
79 // panel1
80 //
81 this.panel1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panel1.BackgroundImage")));
82 this.panel1.Controls.Add(this.lblScore);
83 this.panel1.Location = new System.Drawing.Point(451, 13);
84 this.panel1.Name = "panel1";
85 this.panel1.Size = new System.Drawing.Size(309, 424);
86 this.panel1.TabIndex = 4;
87 //
88 // panel2
89 //
90 this.panel2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panel2.BackgroundImage")));
91 this.panel2.Location = new System.Drawing.Point(13, 2);
92 this.panel2.Name = "panel2";
93 this.panel2.Size = new System.Drawing.Size(734, 10);
94 this.panel2.TabIndex = 5;
95 //
96 // panel3
97 //
98 this.panel3.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panel3.BackgroundImage")));
99 this.panel3.Location = new System.Drawing.Point(3, 2);
100 this.panel3.Name = "panel3";
101 this.panel3.Size = new System.Drawing.Size(10, 435);
102 this.panel3.TabIndex = 6;
103 //
104 // panel4
105 //
106 this.panel4.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panel4.BackgroundImage")));
107 this.panel4.Location = new System.Drawing.Point(3, 437);
108 this.panel4.Name = "panel4";
109 this.panel4.Size = new System.Drawing.Size(754, 11);
110 this.panel4.TabIndex = 7;
111 //
112 // ptbGameOver
113 //
114 this.ptbGameOver.Image = ((System.Drawing.Image)(resources.GetObject("ptbGameOver.Image")));
115 this.ptbGameOver.Location = new System.Drawing.Point(13, 13);
116 this.ptbGameOver.Name = "ptbGameOver";
117 this.ptbGameOver.Size = new System.Drawing.Size(432, 389);
118 this.ptbGameOver.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
119 this.ptbGameOver.TabIndex = 0;
120 this.ptbGameOver.TabStop = false;
121 this.ptbGameOver.Visible = false;
122 //
123 // Form1
124 //
125 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
126 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
127 this.ClientSize = new System.Drawing.Size(750, 457);
128 this.Controls.Add(this.ptbGameOver);
129 this.Controls.Add(this.lblGameOver);
130 this.Controls.Add(this.panel4);
131 this.Controls.Add(this.panel3);
132 this.Controls.Add(this.panel2);
133 this.Controls.Add(this.panel1);
134 this.Controls.Add(this.pbCanvas);
135 this.Name = "Form1";
136 this.Text = "Game rắn săn mồi";
137 this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
138 this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyUp);
139 ((System.ComponentModel.ISupportInitialize)(this.pbCanvas)).EndInit();
140 this.panel1.ResumeLayout(false);
141 this.panel1.PerformLayout();
142 ((System.ComponentModel.ISupportInitialize)(this.ptbGameOver)).EndInit();
143 this.ResumeLayout(false);
144 this.PerformLayout();
145
146 }
147
148 #endregion
149
150 private System.Windows.Forms.PictureBox pbCanvas;
151 private System.Windows.Forms.Label lblScore;
152 private System.Windows.Forms.Timer gameTimer;
153 private System.Windows.Forms.Label lblGameOver;
154 private System.Windows.Forms.Panel panel1;
155 private System.Windows.Forms.Panel panel2;
156 private System.Windows.Forms.Panel panel3;
157 private System.Windows.Forms.Panel panel4;
158 private System.Windows.Forms.PictureBox ptbGameOver;
159 }
160 }
2 {
3 partial class Form1
4 {
5 /// <summary>
6 /// Required designer variable.
7 /// </summary>
8 private System.ComponentModel.IContainer components = null;
9
10 /// <summary>
11 /// Clean up any resources being used.
12 /// </summary>
13 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14 protected override void Dispose(bool disposing)
15 {
16 if (disposing && (components != null))
17 {
18 components.Dispose();
19 }
20 base.Dispose(disposing);
21 }
22
23 #region Windows Form Designer generated code
24
25 /// <summary>
26 /// Required method for Designer support - do not modify
27 /// the contents of this method with the code editor.
28 /// </summary>
29 private void InitializeComponent()
30 {
31 this.components = new System.ComponentModel.Container();
32 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
33 this.pbCanvas = new System.Windows.Forms.PictureBox();
34 this.lblScore = new System.Windows.Forms.Label();
35 this.gameTimer = new System.Windows.Forms.Timer(this.components);
36 this.lblGameOver = new System.Windows.Forms.Label();
37 this.panel1 = new System.Windows.Forms.Panel();
38 this.panel2 = new System.Windows.Forms.Panel();
39 this.panel3 = new System.Windows.Forms.Panel();
40 this.panel4 = new System.Windows.Forms.Panel();
41 this.ptbGameOver = new System.Windows.Forms.PictureBox();
42 ((System.ComponentModel.ISupportInitialize)(this.pbCanvas)).BeginInit();
43 this.panel1.SuspendLayout();
44 ((System.ComponentModel.ISupportInitialize)(this.ptbGameOver)).BeginInit();
45 this.SuspendLayout();
46 //
47 // pbCanvas
48 //
49 this.pbCanvas.BackColor = System.Drawing.SystemColors.ScrollBar;
50 this.pbCanvas.Location = new System.Drawing.Point(13, 13);
51 this.pbCanvas.Name = "pbCanvas";
52 this.pbCanvas.Size = new System.Drawing.Size(432, 424);
53 this.pbCanvas.TabIndex = 0;
54 this.pbCanvas.TabStop = false;
55 this.pbCanvas.Paint += new System.Windows.Forms.PaintEventHandler(this.pbCanvas_Paint);
56 //
57 // lblScore
58 //
59 this.lblScore.AutoSize = true;
60 this.lblScore.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
61 this.lblScore.ForeColor = System.Drawing.Color.Blue;
62 this.lblScore.Location = new System.Drawing.Point(83, 18);
63 this.lblScore.Name = "lblScore";
64 this.lblScore.Size = new System.Drawing.Size(0, 37);
65 this.lblScore.TabIndex = 2;
66 //
67 // lblGameOver
68 //
69 this.lblGameOver.AutoSize = true;
70 this.lblGameOver.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
71 this.lblGameOver.ForeColor = System.Drawing.Color.Red;
72 this.lblGameOver.Location = new System.Drawing.Point(158, 405);
73 this.lblGameOver.Name = "lblGameOver";
74 this.lblGameOver.Size = new System.Drawing.Size(79, 29);
75 this.lblGameOver.TabIndex = 3;
76 this.lblGameOver.Text = "label2";
77 this.lblGameOver.Visible = false;
78 //
79 // panel1
80 //
81 this.panel1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panel1.BackgroundImage")));
82 this.panel1.Controls.Add(this.lblScore);
83 this.panel1.Location = new System.Drawing.Point(451, 13);
84 this.panel1.Name = "panel1";
85 this.panel1.Size = new System.Drawing.Size(309, 424);
86 this.panel1.TabIndex = 4;
87 //
88 // panel2
89 //
90 this.panel2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panel2.BackgroundImage")));
91 this.panel2.Location = new System.Drawing.Point(13, 2);
92 this.panel2.Name = "panel2";
93 this.panel2.Size = new System.Drawing.Size(734, 10);
94 this.panel2.TabIndex = 5;
95 //
96 // panel3
97 //
98 this.panel3.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panel3.BackgroundImage")));
99 this.panel3.Location = new System.Drawing.Point(3, 2);
100 this.panel3.Name = "panel3";
101 this.panel3.Size = new System.Drawing.Size(10, 435);
102 this.panel3.TabIndex = 6;
103 //
104 // panel4
105 //
106 this.panel4.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panel4.BackgroundImage")));
107 this.panel4.Location = new System.Drawing.Point(3, 437);
108 this.panel4.Name = "panel4";
109 this.panel4.Size = new System.Drawing.Size(754, 11);
110 this.panel4.TabIndex = 7;
111 //
112 // ptbGameOver
113 //
114 this.ptbGameOver.Image = ((System.Drawing.Image)(resources.GetObject("ptbGameOver.Image")));
115 this.ptbGameOver.Location = new System.Drawing.Point(13, 13);
116 this.ptbGameOver.Name = "ptbGameOver";
117 this.ptbGameOver.Size = new System.Drawing.Size(432, 389);
118 this.ptbGameOver.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
119 this.ptbGameOver.TabIndex = 0;
120 this.ptbGameOver.TabStop = false;
121 this.ptbGameOver.Visible = false;
122 //
123 // Form1
124 //
125 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
126 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
127 this.ClientSize = new System.Drawing.Size(750, 457);
128 this.Controls.Add(this.ptbGameOver);
129 this.Controls.Add(this.lblGameOver);
130 this.Controls.Add(this.panel4);
131 this.Controls.Add(this.panel3);
132 this.Controls.Add(this.panel2);
133 this.Controls.Add(this.panel1);
134 this.Controls.Add(this.pbCanvas);
135 this.Name = "Form1";
136 this.Text = "Game rắn săn mồi";
137 this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
138 this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyUp);
139 ((System.ComponentModel.ISupportInitialize)(this.pbCanvas)).EndInit();
140 this.panel1.ResumeLayout(false);
141 this.panel1.PerformLayout();
142 ((System.ComponentModel.ISupportInitialize)(this.ptbGameOver)).EndInit();
143 this.ResumeLayout(false);
144 this.PerformLayout();
145
146 }
147
148 #endregion
149
150 private System.Windows.Forms.PictureBox pbCanvas;
151 private System.Windows.Forms.Label lblScore;
152 private System.Windows.Forms.Timer gameTimer;
153 private System.Windows.Forms.Label lblGameOver;
154 private System.Windows.Forms.Panel panel1;
155 private System.Windows.Forms.Panel panel2;
156 private System.Windows.Forms.Panel panel3;
157 private System.Windows.Forms.Panel panel4;
158 private System.Windows.Forms.PictureBox ptbGameOver;
159 }
160 }